home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------
- ;
- ; PURPOSE Create widget text for information.
- ; It can be used in conjuction with
- ; the routines <<gettips.pro>> and
- ; <<puttips.pro>>.
- ;
- pro widtips, $
- wParentBase, $ ; IN: parent base identifer
- textArray, $ ; IN: text array to be displayed.
- XSIZE= xSize, $ ; IN: (opt) widget x size (in characters)
- YSIZE= ySize, $ ; IN: (opt) widget y size (in characters)
- NWIDGETS= nWidgets, $ ; IN: (opt) number of widget text to create
- WIDGETID ; OUT: widget identifer
-
- ; Check the validity of the input parameters.
- ;
- if (N_ELEMENTS(wParentBase) EQ 0) then begin
- PRINT,'Error in widtips.pro : you must pass a parent base.'
- RETURN
- endif
-
- ; Set the default value of the optional parameters.
- ;
- if (N_ELEMENTS(xSize) EQ 0) then begin
- xSize = 40
- endif
- if (N_ELEMENTS(ySize) EQ 0) then begin
- ySize = 3
- endif
- if (N_ELEMENTS(nWidgets) EQ 0) then begin
- nWidgets = 1
- endif
-
- ; For the demo purposes only, set the x size to 43.
- ; Maximumn number of cahracters per line is 42.
- ;
- xSize = 43
-
- ; Create the widget id array.
- ;
- widgetID = LONARR(nWidgets)
-
- ; Get the geometry of the top level base.
- ;
- tlbGeom = WIDGET_INFO(wParentBase, /GEOMETRY)
-
- tlbXSize = tlbgeom.scr_xsize + (2 * tlbgeom.margin)
- tlbYSize = tlbgeom.scr_ysize + (2 * tlbgeom.margin)
-
- ; Verify that the textArray size is big enough.
- ;
- sztext = size(textArray)
- nMin = nWidgets*ysize
- if (sztext[1] LT nMin) then begin
- PRINT, 'Error in widtips.pro : The text Array must have a'
- PRINT, 'minimum of ', nMin, ' elements.'
- PRINT, 'It currently has ', szText[1], ' elements'
- RETURN
- endif
-
- ; Create the widgets.
- ; Notice the value of the text. It assign the text value
- ; from the initial textArray successively.
- ;
- for i = 0, nWidgets-1 do begin
- textValue = textArray[ i*ysize : (i+1)*ysize-1]
-
- widgetID[i] = WIDGET_TEXT(wParentBase, $
- VALUE=textValue, $
- XSIZE=xsize, YSIZE=ysize)
- endfor
-
- end ; of widtips.pro
-